+2007-01-28 Øyvind Kolås <pippin@gimp.org>
+
+ * extensions/gegl-fixups.c: (conv_bgrA8_rgba8), (init): added
+ optimized permutator for going from cairo's buffer format to RGBA byte
+ order, as well as unpremultiplying.
+
2007-01-28 Øyvind Kolås <pippin@gimp.org>
* extensions/gegl-fixups.c: fixed gamma conversion.
static unsigned char table_F_8[1 << 16];
static unsigned char table_F_8g[1 << 16];
-
static int table_inited = 0;
static void
return samples;
}
+static long
+conv_bgrA8_rgba8 (unsigned char *srcc,
+ unsigned char *dstc,
+ long samples)
+{
+ unsigned char *src = (void*)srcc;
+ unsigned char *dst = (void*)dstc;
+ long n=samples;
+ while (n--)
+ {
+ unsigned char alpha=src[3];
+ dst[0]=alpha?(src[2]*255/alpha):0;
+ dst[1]=alpha?(src[1]*255/alpha):0;
+ dst[2]=alpha?(src[0]*255/alpha):0;
+ dst[3]=alpha;
+ src+=4;
+ dst+=4;
+ }
+ return samples;
+}
+
#define conv_rgb8_rgbAF conv_rgb8_rgbaF
babl_component ("B'"),
babl_component ("A"),
NULL);
+ Babl *bgrA8 = babl_format_new (
+ babl_model ("R'aG'aB'aA"),
+ babl_type ("u8"),
+ babl_component ("B'a"),
+ babl_component ("G'a"),
+ babl_component ("R'a"),
+ babl_component ("A"),
+ NULL);
Babl *rgb8 = babl_format_new (
babl_model ("R'G'B'"),
babl_type ("u8"),
o (rgbaF, rgb8);
o (rgbAF, rgb8);
o (rgbAF, sdl32);
+ o (bgrA8, rgba8);
return 0;
}